package eerbaar.v2.client;

import java.awt.Container;

import javax.swing.JPanel;

import eerbaar.v2.app.core.App;
import eerbaar.v2.app.core.IApp;
import eerbaar.v2.app.menuMain.MainMenuExtension;
import eerbaar.v2.client.ui.UIExtension;
import eerbaar.v2.ctr.ui.CtrUIExtension;
import eerbaar.v2.effects.EffectExtension;
import eerbaar.v2.gamebuilder.client.GameBuilderExtension;
import eerbaar.v2.menu.MenuExtension;
import eerbaar.v2.pattern.client.PatternExtension;
import eerbaar.v2.wait.internal.WaitExtension;

public class Main {

    public static void init(Container container) {

        registerServices();

        IApp app = App.instance();

        app.addExtention(new UIExtension());
        app.addExtention(new WaitExtension());
        app.addExtention(new MenuExtension());
        app.addExtention(new MainMenuExtension());
        app.addExtention(new PatternExtension());
        app.addExtention(new EffectExtension());
        app.addExtention(new GameBuilderExtension());
        app.addExtention(new CtrUIExtension());

        // MsgHelper.setDebug(CollisionMsg.class, true);

        app.init(container);
    }

    public static void main(String[] args) {

        init(new JPanel());
    }

    private static void registerServices() {
        new eerbaar.expression.Module().registerServices();
        new eerbaar.expression.lib.Module().registerServices();
        new eerbaar.action.Module().registerServices();
        new eerbaar.action.lib.Module().registerServices();
        new eerbaar.shared.persist.Module().registerServices();
        new eerbaar.shared.persist.lib.Module().registerServices();
        new eerbaar.shared.message.Module().registerServices();
        new eerbaar.message.lib.Module().registerServices();
        new eerbaar.client.ctr.Module().registerServices();
        new eerbaar.collision.Module().registerServices();
        new eerbaar.server.serializer.Module().registerServices();
    }

}
